#include <chrono>
#include <memory>
#include <rclcpp/rclcpp.hpp>

class Log {
public:
  Log() {
    logger_ = std::make_shared<rclcpp::Logger>(rclcpp::get_logger("log"));
    clock_ = std::make_shared<rclcpp::Clock>(RCL_STEADY_TIME);
  }

  void timer_out() {
    while (1) {
      RCLCPP_INFO_THROTTLE(*logger_, *clock_, 4000, "print info first...");
      RCLCPP_INFO_THROTTLE(*logger_, *clock_, 2000, "print info second...");
      rclcpp::sleep_for(std::chrono::seconds(1));
    }
  }

private:
  std::shared_ptr<rclcpp::Logger> logger_;
  std::shared_ptr<rclcpp::Clock> clock_;
};

int main(int argc, char **argv) {
  rclcpp::init(argc, argv);
  auto node = std::make_shared<Log>();
  node->timer_out();
  //   rclcpp::spin(node);
  //   rclcpp::shutdown();

  return 0;
}